package com.qdlc.p2p.dal.dao.impl;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.qdlc.p2p.dal.common.dao.jpa.BaseDaoImpl;
import com.qdlc.p2p.dal.dao.DrawBankDao;
import com.qdlc.p2p.dal.dto.DrawBank;

@Repository("drawBankDao")
public class DrawBankDaoImpl extends BaseDaoImpl<DrawBank> implements DrawBankDao {
	@SuppressWarnings("unchecked")
	@Override
	public DrawBank getDrawBankByBankCode(String bankCode){
		String sql = " from DrawBank where bankCode = ?1";
		Query query = em.createQuery(sql);
		query.setParameter(1, bankCode);
		List<DrawBank> list = query.getResultList();
		if(list.size()>0){
			return list.get(0);
		}else{
			return null;
		}
	}
}
